package com.fourGirlsAndADude.mobileDRT;

import com.actionbarsherlock.app.SherlockActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.app.Activity;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.graphics.Typeface;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.MenuInflater;

public class AdminMenuActivity extends SherlockActivity {

	ImageView glc;
	ImageView rs;

	String userName;
	String authType;
	String token;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_admin_menu);

		Intent intent = getIntent();
		userName = intent.getStringExtra("USERNAME");
		authType = intent.getStringExtra("AUTHORIZATION_TYPE");
		token = intent.getStringExtra("SESSION_TOKEN");
		
		//getSupportActionBar().setTitle("Administrator");
		//getSupportActionBar().setSubtitle(userName);
		// Typeface typeface = Typeface.createFromAsset(getAssets(),
		// "fonts/Roboto-Thin.tff");

		glc = (ImageView) findViewById(R.id.glc);
		// glc.setTypeface(typeface);
		glc.setOnClickListener(new glcOnClickListener());
		rs = (ImageView) findViewById(R.id.cre);
		// rs.setTypeface(typeface);
		rs.setOnClickListener(new rsOnClickListener());

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getSupportMenuInflater().inflate(R.menu.admin_menu, menu);

		ActionBar actionBar = getSupportActionBar();
		// Set text in action bar
		actionBar.setTitle(R.string.admin_menu_title);
		return true;
	}

	private class glcOnClickListener implements Button.OnClickListener {

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			Intent intent = new Intent(getBaseContext(),
					SearchableActivity.class);
			intent.putExtra("USERNAME", userName);
			intent.putExtra("AUTHORIZATION_TYPE", authType);
			intent.putExtra("SESSION_TOKEN", token);
			startActivity(intent);
		}

	}

	private class rsOnClickListener implements Button.OnClickListener {

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			Intent intent = new Intent(getBaseContext(),
					ReportsSelectionActivity.class);
			intent.putExtra("USERNAME", userName);
			intent.putExtra("AUTHORIZATION_TYPE", authType);
			intent.putExtra("SESSION_TOKEN", token);
			startActivity(intent);
		}

	}
}
